customproperty: Implement assign vfunc
authorBenjamin Otte <otte@redhat.com>
Wed, 28 Mar 2012 03:15:48 +0000 (05:15 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:14 +0000 (08:59 +0200)
I'm going to overwrite the GtkCssStyleProperty one, so better keep this
one.

gtk/gtkcsscustomproperty.c

index 9da425fe7ae7f4a9199e13b1706f9be7a8360071..0f20c1fc7f842ceead4c561b30e06e9d7265bc7c 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "gtkcssstylefuncsprivate.h"
+#include "gtkstylepropertiesprivate.h"
 #include "gtkthemingengine.h"
 
 G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY)
@@ -100,6 +101,20 @@ gtk_css_custom_property_query (GtkStyleProperty   *property,
   g_assert (GTK_CSS_CUSTOM_PROPERTY (property)->pspec->value_type == G_VALUE_TYPE (value));
 }
 
+static void
+gtk_css_custom_property_assign (GtkStyleProperty   *property,
+                                GtkStyleProperties *props,
+                                GtkStateFlags       state,
+                                const GValue       *value)
+{
+  GtkCssValue *css_value = _gtk_css_value_new_from_gvalue (value);
+  _gtk_style_properties_set_property_by_property (props,
+                                                  GTK_CSS_STYLE_PROPERTY (property),
+                                                  state,
+                                                  css_value);
+  _gtk_css_value_unref (css_value);
+}
+
 static void
 _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
 {
@@ -107,6 +122,7 @@ _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
 
   property_class->parse_value = gtk_css_custom_property_parse_value;
   property_class->query = gtk_css_custom_property_query;
+  property_class->assign = gtk_css_custom_property_assign;
 }
 
 static GtkCssValue *